package com.su.dolphin.model.db;

import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.DbUtils.DbUpgradeListener;
import com.su.dolphin.DpApp;

public class DpBaseDao
{
    private static DbUtils sDbUtils;
    public static int DB_VERSION = 1;
    public static String DB_NAME = "dolphin.db";
    
    // 参考地址 http://my.oschina.net/jack1900/blog/174125
    public static void init() {
        sDbUtils = DbUtils.create(DpApp.getContext(), DB_NAME, DB_VERSION, new DbUpgradeListener()
        {
            
            @Override
            public void onUpgrade(DbUtils arg0, int arg1, int arg2) {
                
            }
        });
    }
    
    public static DbUtils getDb() {
        if (sDbUtils == null) {
            throw new RuntimeException("DpBaseDb did not initialized!");
        }
        return sDbUtils;
    }
}
